const path = require ('path');
const webpack = require ('webpack'); //访问内置的插件cls
const HtmlWebpackPlugin = require ('html-webpack-plugin'); //通过 npm 安装

module.exports = {
  mode: 'development',
  mode: 'production',
  entry: './src/index.ts',
  output: {
    path: path.resolve (__dirname, 'dist'),
    filename: 'bundle.js',
    library: 'DateApi',
    libraryTarget: "umd",
    libraryExport: "default"
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  devServer: {
    contentBase: path.join (__dirname, 'dist'),
    compress: true,
    port: 9000,
  },
  module: {
    rules: [{test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/}],
  },
  plugins: [new HtmlWebpackPlugin ({template: './index.html'})],
};
